package com.jxsm.service.impl;

import com.jxsm.dao.ContractProductDao;
import com.jxsm.page.Page;
import com.jxsm.pojo.Contract;
import com.jxsm.pojo.ContractProduct;
import com.jxsm.service.ContractProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.UUID;

/**
 * Created by Administrator on 2016/11/3.
 */
@Service
public class ContractProductServiceImpl implements ContractProductService {
    @Autowired
    private ContractProductDao contractProductDao;
    public void insert(ContractProduct entity) {
        entity.setId(UUID.randomUUID().toString());
        entity.setAmount(entity.getPrice()*entity.getCnumber());
        contractProductDao.insert(entity);
    }

    public void update(ContractProduct entity) {
        contractProductDao.update(entity);
    }

    public void deleteById(Serializable id) {
        contractProductDao.deleteById(id);
    }

    public void delete(Serializable[] id) {
        contractProductDao.delete(id);
    }

    public List<ContractProduct> findPage(Page page) {
        return contractProductDao. findPage(page);
    }

    public List<ContractProduct> find(Map map) {

        return contractProductDao.findAll(map);
    }

    public ContractProduct get(Serializable id) {
        return contractProductDao.get(id) ;
    }
}
